import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GymUserVO, GymUserForm, GymUserQuery } from '@/api/primary/gymUser/types';

/**
 * 查询健身房人员信息列表
 * @param query
 * @returns {*}
 */

export const listGymUser = (query?: GymUserQuery): AxiosPromise<GymUserVO[]> => {
  return request({
    url: '/primary/gymUser/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询健身房人员信息详细
 * @param id
 */
export const getGymUser = (id: string | number): AxiosPromise<GymUserVO> => {
  return request({
    url: '/primary/gymUser/' + id,
    method: 'get'
  });
};

/**
 * 新增健身房人员信息
 * @param data
 */
export const addGymUser = (data: GymUserForm) => {
  return request({
    url: '/primary/gymUser',
    method: 'post',
    data: data
  });
};

/**
 * 修改健身房人员信息
 * @param data
 */
export const updateGymUser = (data: GymUserForm) => {
  return request({
    url: '/primary/gymUser',
    method: 'put',
    data: data
  });
};

/**
 * 删除健身房人员信息
 * @param id
 */
export const delGymUser = (id: string | number | Array<string | number>) => {
  return request({
    url: '/primary/gymUser/' + id,
    method: 'delete'
  });
};
